<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('提成报表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li class="select-time">
                                <label>提成日期：</label>
                                <input type="text" class="time-input"  id="beginTime" placeholder="开始日期" name="params[beginTime]" th:value="${beginTime}"/>
                                <span>-</span>
                                <input type="text" class="time-input"  id="endTime" placeholder="结束日期" name="params[endTime]" th:value="${endTime}"/>
                                <span><a  onclick="prevMonth()">上月</a> <a  onclick="nextMonth()">下月</a></span>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/ProjectBonus";
        var generateTypeDatas  = [[${@dict.getType('generate_type')}]];

        $(function() {
            var options = {
                url: prefix + "/report",
                showRefresh: false,
                showToggle: false,
                showSearch: false,
                showColumns: false,
                modalName: "项目提成",
                columns: [
                {
                    field: 'userName',
                    title: '姓名'
                },
                {
                    field: 'bonusAmount',
                    title: '提成金额'
                }]
            };
            $.table.init(options);
        });

        function prevMonth()
        {
            var date = new Date($('#beginTime').val());
            date.setMonth(date.getMonth() - 1);
            $('#beginTime').val(date.getFullYear() + '-' + (date.getMonth()+1) + '-1');
            date.setMonth(date.getMonth()+1);
            date.setDate(0);
            $('#endTime').val(date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate());
        }
        function nextMonth()
        {
            var date = new Date($('#beginTime').val());
            date.setMonth(date.getMonth() + 1);
            $('#beginTime').val(date.getFullYear() + '-' + (date.getMonth()+1) + '-1');
            date.setMonth(date.getMonth() + 1);
            date.setDate(0);
            $('#endTime').val(date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate());
        }
    </script>
</body>
</html>